/*
 * Copyright 2016 Yan Zhenjie
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mingmen.canting.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mingmen.canting.R;
import com.mingmen.canting.gongyingshang.GongYingNewDetailFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * <p>
 * ListView形式的侧滑菜单，支持横向和竖向的。
 * </p>
 * Created by Yan Zhenjie on 2016/7/27.
 */
public class DefaultListActivity extends Activity {
    @BindView(R.id.img_return)
    ImageView imgReturn;

    @BindView(R.id.layout_close)
    LinearLayout layoutClose;


    String string;

    @BindView(R.id.btn_submit)
    Button btn_submit;
    String commodityName;
    String categoryName;
    @BindView(R.id.text_gongying)
    TextView text_gongying;
    @BindView(R.id.text_shopcommodity)
    TextView text_shopcommodity;
    String commodityId;
    String pos;
    String isDefault;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_default_lis);
        ButterKnife.bind(this);
        commodityName = getIntent().getStringExtra("commodityName");
        categoryName = getIntent().getStringExtra("categoryName");
        text_gongying.setText(categoryName);
        text_shopcommodity.setText(commodityName);
        commodityId = getIntent().getStringExtra("commodityId");
        pos = getIntent().getStringExtra("pos");
        isDefault = getIntent().getStringExtra("isDefault");
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();

    }

    @OnClick({R.id.img_return, R.id.layout_close, R.id.btn_submit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.layout_close:
                finish();
                break;
            case R.id.img_return:
                finish();
                break;
            case R.id.btn_submit:
//                Intent intent = new Intent(DefaultListActivity.this, ShopDetailRightFragment.class);
                Intent intent = new Intent(DefaultListActivity.this, GongYingNewDetailFragment.class);
                intent.putExtra("companyId", "666");
                intent.putExtra("commodityId", commodityId);
                intent.putExtra("pos", pos);
                intent.putExtra("isDefault",isDefault);
                setResult(100, intent);
                finish();
                break;
        }
    }

}